<template>
<h1>猜数字练习</h1>
  <input type="text" v-model="f">
  <button @click="f1()">猜一猜</button>
  <h4>小提示：{{b}}</h4>
</template>

<script setup>
import {ref} from "vue";

const f = ref('');
const a = Math.floor(Math.random()*100+1);
console.log(a);
const b = ref('');
const f1 = () => {
  if(f.value == a){
    b.value = '恭喜你猜对了';
  }else if(f.value > a){
    b.value = '太大了';
  }else{
    b.value = '太小了';
  }


}
</script>


<style scoped>

</style>